package org.example.sword2offer.primary;


/**
 * @author: lynn
 * @Descript: 操作给定的二叉树，将其变换为源二叉树的镜像
 * @date: 2021/3/10 0:33
 * @version: 1.0
 */
public class Q18_MirrorTrees {

    public static void main(String[] args) {
        TreeNode pTreeNode=new TreeNode(10);
        pTreeNode.left=new TreeNode(7);
        pTreeNode.right=new TreeNode(12);
        pTreeNode.left.left=new TreeNode(3);
        pTreeNode.left.right=new TreeNode(4);
        pTreeNode.right.left=new TreeNode(11);
        pTreeNode.right.right=new TreeNode(13);


    }

    private static TreeNode doMirror(TreeNode treeNode){ // fixme need response
        if (treeNode==null) return null;
        TreeNode tempNode=treeNode.left;
        treeNode.left=treeNode.right;
        treeNode.right=tempNode;
        doMirror(treeNode.left);
        doMirror(treeNode.right);
        return treeNode;
    }

    private static class TreeNode{
        int val;
        TreeNode left;
        TreeNode right;
        public TreeNode(int val){
            this.val=val;
        }
    }
}
